package io.finer.erp.jeecg.stock.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.jeecg.common.api.vo.Result;

import com.alibaba.fastjson.JSONObject;

import cn.hutool.core.collection.CollUtil;
import io.finer.erp.jeecg.bas.entity.BasMaterial;
import io.finer.erp.jeecg.bas.entity.BasMaterialTemp;
import io.finer.erp.jeecg.bas.entity.ZrkShoporder;
import io.finer.erp.jeecg.stock.entity.StkIoBill;
import io.finer.erp.jeecg.stock.entity.StkIoBillEntry;
import io.finer.erp.jeecg.stock.entity.StkIoMaterialLog;
import io.finer.erp.jeecg.stock.vo.CompanyModel;
import io.finer.erp.jeecg.stock.vo.ScanIO;

public interface IScan2ndService {
	
	/**
	 * @Description 出入库计算物料ID
	 * @param materialId
	 * @param billId
	 * @param orderId
	 * @param processId
	 * @return
	 * Create at: 2020-10-24 15:29:34
	 * @author: duany
	 * Revision:
	 *    2020-10-24 15:29:34 - first revision by duany
	 *        
	 */
	public BigDecimal getMaterialCost(StkIoMaterialLog ioLog);

	/**
	 * @Description 代加工入库时查询代加工移库的单据
	 * @return
	 * Create at: 2020-11-02 11:06:15
	 * @author: duany
	 * Revision:
	 *    2020-11-02 11:06:15 - first revision by duany
	 *        
	 */
	public Result<?> getProcessingOrder();

	/**
	 * @Description 代加工入库进行的操作
	 * @param scanIo
	 * @param result
	 * @return
	 * Create at: 2020-11-02 12:01:12
	 * @author: duany
	 * Revision:
	 *    2020-11-02 12:01:12 - first revision by duany
	 *        
	 */
	public Result<JSONObject> processingIn(ScanIO scanIo, Result<JSONObject> result);
	
	/**
	 * @Description 获取物流公司
	 * @return
	 * Create at: 2020-10-24 09:23:32
	 * @author: duany
	 * Revision:
	 *    2020-10-24 09:23:32 - first revision by duany
	 *        
	 */
	List<CompanyModel> getCompany();
	
	/**
	 * @Description 生产人员维护生产出的物料信息。
	 * @param scanIo
	 * @return
	 * Create at: 2020-10-07 11:29:14
	 * @author: duanyong
	 * Revision:
	 *    2020-10-07 11:29:14 - first revision by duanyong
	 *        
	 */
	Result<?> productInfo(ScanIO scanIo);

	/**
	 * @Description 根据工序和物料更改相关的提货单isout状态（是否出库）
	 * @param materialId
	 * @param procedureId
	 * Create at: 2020-11-11 13:06:20
	 * @author: duany
	 * Revision:
	 *    2020-11-11 13:06:20 - first revision by duany
	 *        
	 */
	public void changePickUpEntryIsOut(String materialId, String procedureId);

	/**
	 * @Description 检查销售出库物料与订单是否匹配
	 * @param order
	 * @param materialList
	 * @return
	 * Create at: 2020-11-11 14:34:16
	 * @author: duany
	 * Revision:
	 *    2020-11-11 14:34:16 - first revision by duany
	 *        
	 */
	public String checkSaleOutOrder(ZrkShoporder order, List<BasMaterial> materialList, ScanIO scanIo);

	/**
	 * @Description 库存调拨时检查物料编码所对应的物料，及获取物料所属的仓库信息。
	 * @param scanIo
	 * @return
	 * Create at: 2020-11-16 15:48:24
	 * @author: duany
	 * Revision:
	 *    2020-11-16 15:48:24 - first revision by duany
	 *        
	 */
	public Result<?> getMaterialWarehouse(ScanIO scanIo);

	/**
	 * @Description 库存调拨
	 * @param scanIo
	 * @return
	 * Create at: 2020-11-16 16:13:24
	 * @author: duany
	 * Revision:
	 *    2020-11-16 16:13:24 - first revision by duany
	 *        
	 */
	public Result<?> transfer(ScanIO scanIo);

	/**
	 * @Description 临时执行的录入方法，将已有的物料入库。
	 * @param scanIo
	 * @param result
	 * @return
	 * Create at: 2020-11-20 09:59:53
	 * @author: duany
	 * Revision:
	 *    2020-11-20 09:59:53 - first revision by duany
	 *        
	 */
	public Result<JSONObject> tempStorage(ScanIO scanIo, Result<JSONObject> result);
	
	/**
	 * @Description 采购入库时核对采购单，计算采购成本
	 * @param list
	 * @return
	 * Create at: 2020-11-20 14:07:06
	 * @author: duany
	 * Revision:
	 *    2020-11-20 14:07:06 - first revision by duany
	 *        
	 */
	public BigDecimal computingStorageCosts(StkIoBill purchaseOrder, BasMaterial material, BigDecimal number);

	/**
	 * @Description 胶水入库
	 * @param scanIo
	 * @param result
	 * @return
	 * Create at: 2020-11-21 09:20:39
	 * @author: duany
	 * Revision:
	 *    2020-11-21 09:20:39 - first revision by duany
	 *        
	 */
	public Result<JSONObject> glueIn(ScanIO scanIo, Result<JSONObject> result);

	/**
	 * @Description 已存在的半成品，进行入库
	 * @param scanIo
	 * @param result
	 * @return
	 * Create at: 2020-11-24 14:48:03
	 * @author: duany
	 * Revision:
	 *    2020-11-24 14:48:03 - first revision by duany
	 *        
	 */
	public Result<JSONObject> existedHalfIn(ScanIO scanIo, Result<JSONObject> result);

	/**
	 * @Description 查询检查员
	 * @return
	 * Create at: 2020-11-28 12:04:16
	 * @author: duany
	 * Revision:
	 *    2020-11-28 12:04:16 - first revision by duany
	 *        
	 */
	public Result<?> inspector();

	/**
	 * @Description 根据编码溯源
	 * @param code
	 * @return
	 * Create at: 2020-12-01 11:02:25
	 * @author: duany
	 * Revision:
	 *    2020-12-01 11:02:25 - first revision by duany
	 *        
	 */
	public Result<?> trace(String code);

	/**
	 * @Description 生产入库时计算相关成本
	 * @param entryList
	 * @param operType
	 * @param mesId
	 * @return
	 * Create at: 2021-02-26 16:39:37
	 * @author: duany
	 * Revision:
	 *    2021-02-26 16:39:37 - first revision by duany
	 * @param tempList 
	 *        
	 */
	public List<StkIoBillEntry> countCost(List<StkIoBillEntry> entryList, String operType, String mesId
			, List<BasMaterialTemp> tempList, Map<String, BasMaterial> materialMap,
			Map<String, BasMaterial> materialMapKeyId);
}
